package org.eyeTopLight.po;

import lombok.Data;
import org.eyeTopLight.constant.ConstantUtil;
import org.eyeTopLight.po.initEntity.Goods;

import java.text.SimpleDateFormat;
import java.util.Date;


@Data
public class SunglassesGoods implements Goods {

        private Integer sunglassesGoods_id;
        private Date sunglassesGoods_updateDate;
        private String sunglassesGoods_name;
        private String sunglassesGoods_desc;
        private String sunglassesGoods_category;
        private String sunglassesGoods_imageUrl;
        private Double sunglassesGoods_price;
        private Integer sunglassesGoods_store;
        private Integer sunglassesGoods_onShelf;
        private Integer sunglassesGoods_imageCount;
        private Integer sunglassesGoods_salesMonth;
        private Integer sunglassesGoods_salesAll;
        private String sunglassesGoods_detailsImageUrl;
        private Integer sunglassesGoods_detailsImageCount;

        @Override
        public String getImageUrlAtIndex(Integer index){
            String[] imageUrls = sunglassesGoods_imageUrl.split(ConstantUtil.SEPARATOR_SYMBOL);
            if (imageUrls == null || index >= imageUrls.length){
                return null;
            }
            return imageUrls[index];
        }

        @Override
        public String getSymbol(){
            return "sunglasses";
        }

        @Override
        public String getGoods_updateDate(){
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
            String dateTime = formatter.format(getSunglassesGoods_updateDate());
            return dateTime;
        }

        @Override
        public String getGoods_imageUrl(){
            return getSunglassesGoods_imageUrl();
        }
}
